package com.example.aop;

import com.example.aop.service.AccountService;
import com.example.aop.service.OrderService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * ClassName:testTransaction
 * Package:com.example.aop
 * Description:
 *
 * @Author:ZhangXin
 * @Create:2023/5/11-9:25
 * @Version:v1.0
 */
public class testTransaction {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-aop.xml");
        AccountService accountService = applicationContext.getBean("accountService", AccountService.class);
        accountService.transfer();
        accountService.withdraw();

        OrderService orderService = applicationContext.getBean("orderService", OrderService.class);
        orderService.generate();
        orderService.cancel();
    }
}
